package pe.org.cnl.congreso.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import pe.org.cnl.congreso.dao.AcompananteDAO;
import pe.org.cnl.congreso.model.Acompanante;

@Repository
public class AcompananteDAOImpl extends HibernateDaoSupport  implements AcompananteDAO {

	@Autowired
	public AcompananteDAOImpl(SessionFactory sessionFactory){
		setHibernateTemplate( new HibernateTemplate(sessionFactory));
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Acompanante> listarAcompanantes(Integer participante) {
		Query query = getSession().createQuery(" from Acompanante where idParticipante = :pa ")
		.setInteger("pa", participante);
        return query.list();
	}

}
